package tpf.designer.pattern.course6.behavior_pattern1.template_18.InterestRate;

import org.apache.log4j.Logger;

abstract public class Account {

    public static final Logger LOGGER = Logger.getLogger(Account.class);
    protected String accountNumber;

    public Account() {
        accountNumber = null;
    }

    public Account(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public final double calculateInterestRate(){
        double interestRate = doCalculateInterestRate();
        String accountType = doCalculateAccountType();
        double amount = calculateAmount(accountType,accountNumber);

        return amount * interestRate;
    }

    /**
     * 由子类实现
     * @return
     */
    protected abstract String doCalculateAccountType();

    /**
     * 由子类实现
     * @return
     */
    protected abstract double doCalculateInterestRate();

    public final double calculateAmount(String accountType, String accountNumber){
        return 7243.00D;
    }


}
